<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=checkout_shipping_adresss.<br />
 * Allows customer to change the shipping address.
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_checkout_shipping_address_default.php 4852 2006-10-28 06:47:45Z drbyte $
 */
?>

<div class="order_wrapper">
<?php echo zen_draw_form('checkout_address', zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'), 'post', 'onsubmit="return check_form_optional(checkout_address);"'); ?>
<?php if ($messageStack->size('checkout_address') > 0) echo $messageStack->output('checkout_address'); ?>

        	<h2><img src="images/order/tit_delivery.png" /><span>请仔细检查你的送货地址，你也可以修改送货地址，下次购物将会有最近的历史记录。</span></h2>
            <div class="address_wrapper clearfix">
             <?php 
                  $address = zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />');
                  $length  = strlen($address);
                  if($length > 31){
                   ?>
            	<div class="col_1">
                	<h3>当前送货地址</h3>
                    <p>
                    <?php 
                    
                    echo html_entity_decode($address); 
                    //echo zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />'); 
                    ?>
                    
                    </p>
                </div>
                <?php } ?>
            	<div class="col_2">
                	<h3>更改送货地址</h3>
                  	<table width="100%" border="0">
                      <tr>
                        <td height="35" valign="middle">名字：</td>
                        <td><?php echo zen_draw_input_field('firstname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' id="firstname" class="ipt"') . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?>
                        
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">姓氏：</td>
                        <td>
                        <?php echo zen_draw_input_field('lastname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', '40') . ' id="lastname" class="ipt"') . (zen_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="alert">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?>
                        
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">详细地址：</td>
                        <td>
                        <?php echo zen_draw_input_field('street_address', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', '40') . ' id="street-address" class="ipt"') . (zen_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="alert">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">城市：</td>
                        <td>
                        <?php echo zen_draw_input_field('city', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . ' id="city" class="ipt"') . (zen_not_null(ENTRY_CITY_TEXT) ? '<span class="alert">' . ENTRY_CITY_TEXT . '</span>': ''); ?>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">省份：</td>
                        <td>
                        <?php
                              echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $zone_id, 'id="stateZone" class="ipt"');
                              if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert">' . ENTRY_STATE_TEXT . '</span>'; 
                            
                        ?>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">邮编：</td>
                        <td>
                        <?php echo zen_draw_input_field('postcode', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . ' id="postcode" class="ipt"') . (zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="alert">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle">国家或地区：</td>
                        <td>
                        <?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" class="ipt"' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')) . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" valign="middle"></td>
                        <td valign="middle"><input type="submit" onclick="$('#subform').click();" value="" class="btn_modify" /> <input type="reset" value="重设" class="btn_reset" /></td>
                      </tr>
                    </table>
                  
                </div>
                <?php if ($addresses_count > 1) {  ?>
            	<div class="col_3">
                	<h3>或使用旧送货地址</h3>
                   <?php
                  require($template->get_template_dir('tpl_modules_checkout_address_book.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_checkout_address_book.php');
                    ?>
                </div>
            <?php  } ?>
            
            
            
            
            </div>
           
            <br class="clearBoth" />
            
        <?php echo zen_draw_hidden_field('action', 'submit') . zen_image_submit(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT,'id="subform" style="display:none;"'); ?>
            
        <?php
                  if ($process == true) {
                ?>
                  <div class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
                <?php
                  }
                ?>
 </form>
 </div>
<br class="clearBoth" />
